/**
*   \file   aabbpoint.h
*   \author Dave Reid
*   \brief  Header file for checking if a point is contained inside or on the surface
*           of an AABB.
*/
#ifndef __EAGL_INTERSECT_AABBPOINT_H_
#define __EAGL_INTERSECT_AABBPOINT_H_

#include "../types.h"

namespace eagl
{

inline bool intersect_aabbpoint(const vec3 &aabbExtents, const vec3 &aabbPos, const vec3 &point)
{
    vec3 point_translated(point - aabbPos);

    if (point_translated.x < -aabbExtents.x) return false;
    if (point_translated.x > aabbExtents.x) return false;
    if (point_translated.y < -aabbExtents.y) return false;
    if (point_translated.y > aabbExtents.y) return false;
    if (point_translated.z < -aabbExtents.z) return false;
    if (point_translated.z > aabbExtents.z) return false;

    return true;
}

}

#endif  // __EAGL_INTERSECT_AABBPOINT_H_